package com.base.control;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by yjh on 15-3-12.
 */
public class MFragmentAdapter extends FragmentPagerAdapter {
    List<Fragment> list;

    public MFragmentAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        this.list = list;
    }

    public MFragmentAdapter(FragmentManager fm, Fragment...fragments) {
        this(fm, new ArrayList<Fragment>(Arrays.asList(fragments)));
    }

    @Override
    public Fragment getItem(int i) {
        return list.get(i);
    }

    @Override
    public int getCount() {
        return list.size();
    }
}
